﻿using System;

namespace SharpSqlAnalyzer.nodes
{
	// Token: 0x020002D8 RID: 728
	internal class searchColumnVisitor : IExpressionVisitor
	{
		// Token: 0x0600187F RID: 6271 RVA: 0x003295F1 File Offset: 0x003277F1
		public searchColumnVisitor(string targetColumn, TExpressionList resultList)
		{
			this._resultList = resultList;
			this._targetColumn = targetColumn;
		}

		// Token: 0x06001880 RID: 6272 RVA: 0x00329608 File Offset: 0x00327808
		public virtual bool exprVisit(TParseTreeNode pNode, bool isLeafNode)
		{
			TExpression texpression = (TExpression)pNode;
			if (texpression.ExpressionType == EExpressionType.simple_object_name_t)
			{
				if (this._targetColumn.Contains("."))
				{
					if (this._targetColumn.Equals(texpression.ObjectOperand.ToString(), StringComparison.CurrentCultureIgnoreCase))
					{
						this._resultList.addExpression(texpression);
					}
				}
				else if (this._targetColumn.Equals(texpression.ObjectOperand.ColumnNameOnly, StringComparison.CurrentCultureIgnoreCase))
				{
					this._resultList.addExpression(texpression);
				}
			}
			else if (texpression.ExpressionType == EExpressionType.function_t && texpression.FunctionCall.Args.size() > 0)
			{
				for (int i = 0; i < texpression.FunctionCall.Args.size(); i++)
				{
					TExpressionList texpressionList = texpression.FunctionCall.Args.getExpression(i).searchColumn(this._targetColumn);
					if (texpressionList.size() > 0)
					{
						for (int j = 0; j < texpressionList.size(); j++)
						{
							this._resultList.addExpression(texpressionList.getExpression(j));
						}
					}
				}
			}
			return true;
		}

		// Token: 0x04001875 RID: 6261
		private TExpressionList _resultList;

		// Token: 0x04001876 RID: 6262
		private string _targetColumn;
	}
}
